#include <iostream>
using namespace std;

bool is_primenumber(int num)
{
    for (int i = 2; i <= num / 2; i++)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int num_count;
    cin >> num_count;
    int prime_sum = 0;
    int now_count = 0;
    int init_num = 2;
    do
    {

        if (is_primenumber(init_num))
        {
            now_count++;
            prime_sum += init_num;
        }
        init_num++;
    } while (now_count < num_count);
    cout << prime_sum;
    return 0;
}